﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DTO;

public partial class UserControls_YourInfomationSubmit : System.Web.UI.UserControl
{
    private User _user;
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    public User User
    {
        set
        {
            _user = value;
            txtFirstName.Text = value.FirstName;
            txtLastName.Text = value.LastName;
            txtEmail.Text = value.Email;
            txtPhone.Text = value.Phone;
        }
        get
        {
            if (_user == null)
            {
                return new User()
                {
                    FirstName = txtFirstName.Text.Trim(),
                    LastName = txtLastName.Text.Trim(),
                    Email = txtEmail.Text.Trim(),
                    Phone = txtPhone.Text.Trim()
                };
            }
            else
            {
                _user.FirstName = txtFirstName.Text.Trim();
                _user.LastName = txtLastName.Text.Trim();
                _user.Email = txtEmail.Text.Trim();
                _user.Phone = txtPhone.Text.Trim();
            }
            return _user;
        }
    }
}